import { storage } from '@/utils/storage'
/*
 * @Author: CQJ
 * @Date: 2022-08-25 20:00:27
 * @LastEditors: CQJ
 * @LastEditTime: 2022-09-02 18:19:53
 * @Description:
 */
import { reactive } from 'vue'
import type { TypeListData } from '@/types/site/typeList'
type Key = string
interface TypeState {
  // 所属分类
  categ_id: string | undefined
  // 子分类关键词
  keyword: string | undefined
  site_id: string | undefined
}

// 状态管理
export const typeState = reactive<TypeState>({
  categ_id: undefined,
  keyword: undefined,
  site_id: undefined
})
interface StatusState {
  isEdit: boolean
  addTypeVisible: boolean
  selectedRowKeys: Key[]
  isAdd: boolean
  typeList: TypeListData[]
}
export const statusState = reactive<StatusState>({
  isEdit: false,
  addTypeVisible: false,
  selectedRowKeys: [],
  isAdd: false,
  typeList: []
})
export interface ICopyList {
  id: string
  name: string
}
export const resetState = () => {
  let key: keyof TypeState
  for (key in typeState) {
    typeState[key] = undefined
  }
}
